package com.miwzn.boot.component.config.shiro;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Component;

/**
 * @Auther: wzn
 * @Date: 2018/12/4 15:11
 * @Description: Shiro权限标签
 */
@Component
public class ShiroTag {
    /**
     * 是否拥有该权限
     *
     * @param permission 权限标识
     *
     * @return boolean
     */
    public boolean hasPermission(String permission) {
        Subject subject = SecurityUtils.getSubject();
        return subject != null && subject.isPermitted(permission);
    }
}
